

import os 
import json 
import numpy as np 
import torch 

model_names = ["segresnet", "vnet", "swinunet2d", "transbts", 
                    "densehnet", "unet_plus", "att_unet3d", "att_unet25d", 
                    "att_unet2d", "att_unet3d_ml", "att_unet25d_ml", "att_unet2d_ml",
                    "unet3d", "unet25d", "unet2d", "unet3d_ml", "unet25d_ml", "unet2d_ml",
                    "nnunet", "unet3d_2_3ml", "unet2d_2_3ml", "unet2d_2_25ml", "unet25d_2_25ml",
                    "unet25d_25_3ml", "unet3d_25_3ml", "fuse_unet", "unet3d_ml_nouncer", "unet25d_ml_nouncer",
                    "unet2d_ml_nouncer", "unet_2_25_fuse", "unet_2_3_fuse", "unet_25_3_fuse", "fuse_att_unet"]

with open("./huanhu_res.txt") as f :
    lines = f.readlines()

index = 0
for line in lines :
    line = line.strip("\n")

    line = json.loads(line)
    metrics = line[model_names[index]]

    mean = torch.tensor(metrics).mean(dim=0)
    std = torch.tensor(metrics).std(dim=0)

    print(f"name is {model_names[index]}, m is {mean}, std is {std}")

    index += 1